/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.web.persistence.hibernate.filter;

import org.springframework.orm.hibernate3.support.OpenSessionInViewFilter;

import com.genia.toolbox.web.filter.CustomFilter;

/**
 * Servlet 2.3 Filter that binds a Hibernate Session to the thread for the
 * entire processing of the request. Intended for the "Open Session in View"
 * pattern, i.e. to allow for lazy loading in web views despite the original
 * transactions already being completed.
 */
public class TransactionFilter
    extends OpenSessionInViewFilter
    implements CustomFilter
{

  /**
   * Return the order value of this object, with a higher value meaning greater
   * in terms of sorting.
   * <p>
   * Normally starting with 0 or 1, with {@link #LOWEST_PRECEDENCE} indicating
   * greatest. Same order values will result in arbitrary positions for the
   * affected objects.
   * <p>
   * Higher value can be interpreted as lower priority, consequently the first
   * object has highest priority (somewhat analogous to Servlet
   * "load-on-startup" values).
   * <p>
   * Note that order values below 0 are reserved for framework purposes.
   * Application-specified values should always be 0 or greater, with only
   * framework components (internal or third-party) supposed to use lower
   * values.
   * 
   * @return the order value
   * @see #LOWEST_PRECEDENCE
   * @see org.springframework.core.Ordered#getOrder()
   */
  public int getOrder()
  {
    return HIGHEST_PRECEDENCE;
  }

}
